//
//  NoticeRewardCell.m
//  sensen_ios
//
//  Created by 小贝 on 16/3/24.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "NoticeRewardCell.h"
@interface NoticeRewardCell()
{
//    UILabel *titleLabel;
//    UIImageView *titleImageView;
//    UIImageView *bgImageView;
//    UILabel *timeLabel;
//    UILabel *contentLabel;
//

}
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;//标题名
@property (weak, nonatomic) IBOutlet UIImageView *titleImageView;//标题图片
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;//图片
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;//时间
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;//内容
@end
@implementation NoticeRewardCell
- (void)awakeFromNib {
    // Initialization code
}
#pragma mark--抽奖、评奖Model
- (void)setLotteryModel:(LotteryModel *)lotteryModel{
    _lotteryModel = lotteryModel;
    if (_lotteryModel != nil) {
        [_bgImageView setImageURLStr:_lotteryModel.main_img placeholder:[UIImage imageNamed:@"轮播默认图"]];
        NSLog(@"%@",_lotteryModel.post_cate_name);
        _contentLabel.text = _lotteryModel.post_title;
        NSString *startTime = [self getTimeStr:_lotteryModel.post_date];
        NSString *endTime = [self getTimeStr:_lotteryModel.end_time];
        _timeLabel.text = [NSString stringWithFormat:@"时间：%@-%@",startTime,endTime];
        if ([_lotteryModel.post_category isEqualToString:@"6058"]) {
            _titleLabel.text = @"幸运抽奖";
//            _titleLabel.text = _lotteryModel.post_cate_name;
            [_titleImageView setImage:[UIImage imageNamed:@"公告栏-标准_抽奖评奖"]];
        }
        if ([_lotteryModel.post_category isEqualToString:@"6059"]) {
            _titleLabel.text = @"评奖结果";
            [_titleImageView setImage:[UIImage imageNamed:@"公告栏_评奖结果"]];
        }
    }
}

#pragma mark--返回时间
- (NSString *) getTimeStr:(NSString *)timeStr{
    NSNumber *dateNub = [NSNumber numberWithFloat:[timeStr floatValue]];
    NSDate *dateStr = [NSDate getDateFromeNumber:dateNub];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy.MM.dd"];
    return [ dateFormatter stringFromDate:dateStr];
}

#pragma mark--
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
@end
